﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using QLBH.DATA;
using QLBH.DTO;

namespace QLBH.BUSINESS
{
    public class NguoiDungBus
    {
        private static NguoiDungData db = new NguoiDungData();

        public static NGUOI_DUNG DangNhap(string ten_dang_nhap, string matkhau)
        {
            return db.DangNhap(ten_dang_nhap, matkhau);
        }

        public static string ThemMoiNguoiDung(NGUOIDUNGPARAM nguoi_dung)
        {
            if (db.ThemMoiNguoiDung(nguoi_dung))
            {
                return "1";
            }
            else
                return db.Error;
        }

        public static string CapNhatNguoiDung(NGUOIDUNGPARAM nguoi_dung)
        {
            if (db.CapNhatNguoiDung(nguoi_dung))
            {
                return "1";
            }
            else
                return db.Error;
        }


        public static string XoaNguoiDung(string[] ma_nguoi_dung)
        {
            if (db.XoaNguoiDung(ma_nguoi_dung))
            {
                return "1";
            }
            else
                return db.Error;
        }

        public static List<NGUOI_DUNG> TimNguoiDungTheoTen(string ten_dang_nhap, int tong_so_dong)
        {
           return db.TimNguoiDungTheoTen(ten_dang_nhap,tong_so_dong);
            
        }


        public static string DoiMatKhau(string ten_dang_nhap, string matkhaucu, string matkhaumoi)
        {
            if (db.DoiMatKhau(ten_dang_nhap,matkhaucu,matkhaumoi))
            {
                return "Đã thêm thành công";
            }
            else
                return db.Error;
        }
    }
}